package uage.logger

case object LOG_LEVEL {
	var LOG_LEVEL_INFO = 1
	val LOG_LEVEL_TEST = 2
	var LOG_LEVEL_WARNING = 3
	var LOG_LEVEL_ERROR = 4
}

/**
 * Some functions may useful in logger and test
 */
case object logger {
  var CUR_LOG_LEVEL = LOG_LEVEL.LOG_LEVEL_TEST
  /**
   * Show info on console
   * @params
   *   clazz: Class of the invoked method,passing only "this" to it
   *   methodName: method name
   *   params: parameters,if none,just passing null
   */
  def info(clazz:Any,methodName:String,params:List[Any]) = {
    if(CUR_LOG_LEVEL <= LOG_LEVEL.LOG_LEVEL_INFO){
    	var list = params
			if(list == null){
				list = List()
			}
    	println("INFO: " + "<" + clazz.getClass.getName + "> " + methodName + "(" + list.mkString(",") + ")")
    }
    
  }
  
  def test(expr:Any) = {
    if(CUR_LOG_LEVEL <= LOG_LEVEL.LOG_LEVEL_TEST){
    	println("TEST: " + expr)
    }
  }
  
}
